In [1]:
import numpy as np

from bokeh.plotting import figure
from bokeh.io import show, output_notebook, save

In [2]:
output_notebook()


Loading BokehJS ...

WebGL problems

Drag around canvas is shifted down, cut off at top spilling over bottom


In [3]:
N = 10000

x = np.random.normal(0, np.pi, N)
y = np.sin(x) + np.random.normal(0, 0.2, N)

p = figure(output_backend="webgl")
p.scatter(x, y, alpha=0.1)
show(p)


Responsive in notebook

Spills a scroll bar. Not a problem in a vanilla save file.


In [4]:
!conda list | egrep "jupyter|notebook"


jupyter                   1.0.0                    py36_4  
jupyter_client            5.2.2                    py36_0  
jupyter_console           5.2.0            py36he59e554_1  
jupyter_core              4.4.0            py36h7c827e3_0  
notebook                  5.4.0                    py36_0  

In [5]:
p = figure(plot_height=200, sizing_mode='scale_width')
p.scatter(x, y, alpha=0.1)
show(p)



In [6]:
N = 4000
x = np.random.random(size=N) * 100
y = np.random.random(size=N) * 100
radii = np.random.random(size=N) * 1.5
colors = [
    "#%02x%02x%02x" % (int(r), int(g), 150) for r, g in zip(50+2*x, 30+2*y)
]

TOOLS="hover,crosshair,pan,wheel_zoom,zoom_in,zoom_out,box_zoom,undo,redo,reset,tap,save,box_select,poly_select,lasso_select,"

p = figure(tools=TOOLS, sizing_mode='scale_width')

p.scatter(x, y, radius=radii,
          fill_color=colors, fill_alpha=0.6,
          line_color=None)

show(p)



In [9]:
save(p, 'color_scatter.html')


/home/bird/miniconda3/envs/sb2018/lib/python3.6/site-packages/bokeh/io/saving.py:125: UserWarning: save() called but no resources were supplied and output_file(...) was never called, defaulting to resources.CDN
  warn("save() called but no resources were supplied and output_file(...) was never called, defaulting to resources.CDN")
/home/bird/miniconda3/envs/sb2018/lib/python3.6/site-packages/bokeh/io/saving.py:138: UserWarning: save() called but no title was supplied and output_file(...) was never called, using default title 'Bokeh Plot'
  warn("save() called but no title was supplied and output_file(...) was never called, using default title 'Bokeh Plot'")
Out[9]:
'/home/bird/Dev/birdsarah/bokeh-miscellany/color_scatter.html'

In [ ]: